// import generateMap from "./generateMap";
function generateMap<T extends Recordable<LabelValuePair>, K extends keyof T>(obj: T) {
  const arr: LabelValuePair[] = [];
  const _obj: Record<K, T[K]["value"]> &
    Record<T[K]["value"], T[K]["label"]> & { _ALL: LabelValuePair[] } = {} as any;

  Object.keys(obj).forEach((key) => {
    _obj[key as K] = obj[key].value as any;
    _obj[obj[key].value as T[K]["value"]] = obj[key].label as any;
    arr.push(obj[key]);
  });
  _obj._ALL = arr;
  return _obj;
}

export const GlobalStatus = generateMap({
  ENABLE: {
    label: "正常",
    value: 0,
  },
  UNABLE: {
    label: "禁止",
    value: 1,
  },
} as const);

export const RoleStatus = GlobalStatus;

export const ActivityStatus = generateMap({
  ALL: {
    label: "全部",
    value: 0,
  },
  UNPUBLISHED: {
    label: "未发布",
    value: 1,
  },
  SIGNING_UP: {
    label: "报名中",
    value: 2,
  },
  ON_GOING: {
    label: "进行中",
    value: 3,
  },
  PAUSE: {
    label: "已暂停",
    value: 4,
  },
  FINISHED: {
    label: "已结束",
    value: 5,
  },
} as const);

export const MakeUpRecordStatus = generateMap({
  ALL: {
    label: "全部",
    value: 0,
  },
  UNAUDITED: {
    label: "未审核",
    value: 1,
  },
  PASSED: {
    label: "已通过",
    value: 2,
  },
  UNPASSED: {
    label: "未通过",
    value: 3,
  },
} as const);

export const SignInRecordStatus = generateMap({
  ALL: {
    label: "全部",
    value: -1,
  },
  UNSTARTED: {
    label: "未开始",
    value: 0,
  },
  SIGNIN: {
    label: "签到中",
    value: 1,
  },
  FINISHED: {
    label: "已结束",
    value: 2,
  },
} as const);

export const SignInMemberStatus = generateMap({
  SIGN_IN: {
    label: "已签到",
    value: 0,
  },
  NOT_SIGN_IN: {
    label: "未签到",
    value: 1,
  },
  PERMITTED: {
    label: "请假已通过",
    value: 2,
  },
  NOT_READ: {
    label: "请假未批",
    value: 3,
  },
  REFUSED: {
    label: "请假已拒绝",
    value: 4,
  },
} as const);
